<?php
namespace App\Http\Controllers\Map;

use App\Service\HwssService;
use Illuminate\Http\Request;

class HwssController extends BaseController
{
    //货物搜索

    //关键词
    public function hwByKey(Request $request)
    {
        $hw_kw = $request->post('hw_kw', '');
        $res = HwssService::hwByKey($hw_kw);
        if ($res['code'] < 0) {
            return self::toJson(-2, $res['msg']);
        }
        return self::toJson(0, '', $res['data']);
    }

    //搜仓位
    public function cwList(Request $request)
    {
        $hw_id = $request->post('hw_id', 0);
        $hw_num = $request->post('hw_num', 0);
        $res = HwssService::cwList($hw_id, $hw_num);
        if ($res['code'] < 0) {
            return self::toJson(-2, $res['msg']);
        }
        return self::toJson(0, '', $res['data']);
    }

    //搜货物
    public function hwList(Request $request)
    {
        $hw_id = $request->post('hw_id', 0);
        $num = $request->post('num', 0);
        $res = HwssService::hwList($hw_id, $num);
        if ($res['code'] < 0) {
            return self::toJson(-2, $res['msg']);
        }
        return self::toJson(0, '', $res['data']);
    }
}